﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MUtil;

public class AutoLoadList : MonoBehaviour
{
    public AutoLoadManager.FileExtensions fileExtensions;

    public AutoLoadManager.FileTypes fileType = AutoLoadManager.FileTypes.Texture;

    private List<AutoLoadManager.TextureInfo> textureList = new List<AutoLoadManager.TextureInfo>();

    public void Start()
    {
        GameObject currentTran;
        AutoLoadHandler handler;

        for (int i = 0; i < gameObject.transform.childCount; i++)
        {
            currentTran = gameObject.transform.GetChild(i).gameObject;

            handler =  currentTran.AddComponent<AutoLoadHandler>();
            handler.FileType = fileType;
            handler.FileExtension = fileExtensions;
            handler.SingleLoad = false;

            textureList.Add(handler.GetTextureInfo());
        }

        EventManager.Broadcast<List<AutoLoadManager.TextureInfo>>(AutoLoadTextureEnum.MultiPle.ToString(), textureList); 
    }
}
